﻿@model IEnumerable<TaskManager.Domain.BusinessObjects.Task>
@using MvcContrib.UI.Grid
@using MvcContrib.Pagination
@using TaskManager.Web.Extensions

<asp:content id="Content3" contentplaceholderid="head" runat="server">
  <script src="@Url.Content("~/Scripts/Grid.js")" type="text/javascript"></script>
</asp:content>

<script type="text/javascript">
    $(function () {
        EnableAjaxForGrid('taskList');
    });
</script>

@{
    Html.Grid(Model)
        .Sort(ViewBag.sort as GridSortOptions)
        .Attributes(@class => "zebra-striped")
        .Empty("There are no tasks available")
        .Columns(column =>
        {
            column.For(task => Html.ActionLink(task.Summary, "Details", new { id = task.Id })).Named("Summary");
            column.For(task => task.Description).Named("Description").Attributes(style => "width:350px").Sortable(false);
            column.For(task => task.Project.Name).Named("Project").Sortable(false);
            column.For(task => task.Assignee).Named("Assignee").Sortable(true);
            column.For(task => task.Priority).Named("Priority").Sortable(true);
            column.For(task => Html.DisplayFor(m => task.State)).Named("State").Sortable(false);
            column.For(task => task.Updated).Named("Last Modified").Sortable(true);
        }).Render();  
}
@Html.Pager((IPagination)Model, 10, (linkText, routeValues) => Html.ActionLink(linkText, ViewContext.RouteData.Values["Action"].ToString(), routeValues).ToString())

